package com.gt.web.controller.app;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gt.app.domain.EsTitleInfo;
import com.gt.app.service.EsTitleInfoService;
import com.gt.common.core.domain.AjaxResult;
import com.gt.common.core.domain.TreeSelect;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 标题信息表 前端控制器
 * </p>
 *
 * @author caidesheng
 */
@Slf4j
@RestController
@RequestMapping("esTitleInfo")
@Api(tags = "标题信息表接口")
public class EsTitleInfoController {

    @Autowired
    private EsTitleInfoService esTitleInfoService;

    @ApiOperation(value = "获取标题列表")
    @GetMapping(value = "getTitle")
    public AjaxResult getTitle() {
        LambdaQueryWrapper<EsTitleInfo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(EsTitleInfo::getType,1);
        return AjaxResult.success(esTitleInfoService.list(queryWrapper));
    }

    @ApiOperation(value = "获取各类肠镜列表")
    @GetMapping(value = "getColonoscopyTitle")
    public AjaxResult getColonoscopyTitle() {
        LambdaQueryWrapper<EsTitleInfo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(EsTitleInfo::getType,2);
        return AjaxResult.success(esTitleInfoService.list(queryWrapper));
    }

    @ApiOperation(value = "获取各类癌病列表")
    @GetMapping(value = "getCancerTitle")
    public AjaxResult getCancerTitle() {
        LambdaQueryWrapper<EsTitleInfo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(EsTitleInfo::getType,3);
        return AjaxResult.success(esTitleInfoService.list(queryWrapper));
    }

    @ApiOperation(value = "获取手术宣教标题信息")
    @GetMapping(value = "getOperationStudy")
    public AjaxResult getOperationStudy() {
        LambdaQueryWrapper<EsTitleInfo> queryWrapper1 = new LambdaQueryWrapper<>();
        queryWrapper1.eq(EsTitleInfo::getType,4);
        List<EsTitleInfo> knowledgeCircle = esTitleInfoService.list(queryWrapper1);
        LambdaQueryWrapper<EsTitleInfo> queryWrapper2 = new LambdaQueryWrapper<>();
        queryWrapper2.eq(EsTitleInfo::getType,5);
        List<EsTitleInfo> commonDiseases = esTitleInfoService.list(queryWrapper2);
        LambdaQueryWrapper<EsTitleInfo> queryWrapper3 = new LambdaQueryWrapper<>();
        queryWrapper3.eq(EsTitleInfo::getType, 6);
        List<EsTitleInfo> diseases = esTitleInfoService.list(queryWrapper3);
        AjaxResult result = AjaxResult.success();
        result.put("knowledgeCircle",knowledgeCircle);
        result.put("commonDiseases",commonDiseases);
        result.put("diseases",diseases);

        return AjaxResult.success(result);
    }

}
